Skip to content

feat(ENG-279): Add vault account creation to INIT-VAULT#50

Merged
alnoki merged 19 commits intomainfrom
eng-279
Apr 2, 2026
Merged

feat(ENG-279): Add vault account creation to INIT-VAULT#50
alnoki merged 19 commits intomainfrom
eng-279

Conversation

@alnoki
Copy link
Copy Markdown
Contributor

@alnoki alnoki commented Apr 1, 2026

Changes

  1. Extend INIT-VAULT to create vault token accounts via
    CreateAccount CPI, with Token 2022 support via a
    GetAccountDataSize CPI to determine account size at
    runtime (falls back to the fixed 165-byte SPL Token
    account size for non-2022 programs)
  2. Add sol_get_return_data syscall for reading the token
    account size returned by GetAccountDataSize
  3. Add duplicate and data-length checks for base and quote
    vault accounts before initialization, with four new error
    codes (BaseVaultIsDuplicate, BaseVaultHasData,
    QuoteVaultIsDuplicate, QuoteVaultHasData)
  4. Store system_program_id pointer on the frame and use it
    in both INIT-MARKET-PDA and INIT-VAULT for CreateAccount
    CPI program ID (previously set directly on sol_instruction)
  5. Add program_id, lamports_per_byte, mint,
    token_account_data_size, get_return_data_program_id,
    and get_account_data_size_data fields to
    RegisterMarketFrame for vault creation state
  6. Derive vault PDAs from the program ID instead of the token
    program ID
  7. Add interface/src/token.rs module with SPL Token constants
    (ACCOUNT_SIZE, GET_ACCOUNT_DATA_SIZE_DISC)
  8. Add common/token.s assembly file with injected token
    constants
  9. Update INIT-MARKET-PDA to save lamports_per_byte on the
    frame and populate signers_seeds in its ensure contract
  10. Update all three algorithm specs (REGISTER-MARKET,
    INIT-MARKET-PDA, INIT-VAULT) with new require/ensure
    annotations and vault creation pseudocode
  11. Add check_vault! macro to integration tests for verifying
    vault owner, data length, and rent exemption after
    successful registration
  12. Add six new test cases for vault duplicate and data-length
    error paths (BaseVaultIsDuplicate, BaseVaultHasData,
    QuoteVaultIsDuplicate{Dup,NonDup},
    QuoteVaultHasData{Dup,NonDup})
  13. Wire mollusk-svm-programs-token and spl-token-interface
    into the test harness for real token program execution
  14. Update layout.md directory tree and add Token constants
    section

@linear
Copy link
Copy Markdown

linear bot commented Apr 1, 2026

ENG-279

@alnoki alnoki changed the title ENG-279 feat(ENG-279): Add vault account creation to INIT-VAULT Apr 2, 2026
@alnoki alnoki marked this pull request as ready for review April 2, 2026 22:38
@alnoki alnoki merged commit c0e28e2 into main Apr 2, 2026
5 of 6 checks passed
@alnoki alnoki deleted the eng-279 branch April 2, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant